reducing fractions to lowest terms